<!DOCTYPE html>
<html lang="en">
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>登录窗口</title>

    <!-- Bootstrap -->
    <link href="/resources/gentelella/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="/resources/gentelella/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="/resources/gentelella/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- Animate.css -->
    <link href="/resources/gentelella/vendors/animate.css/animate.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="/resources/gentelella/css/custom.min.css" rel="stylesheet">
    <script src="/resources/common/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="/resources/common/js/md5.js"></script>
    <script type="application/javascript">
        gotoLoginUrl("/html/admin/login.html");
    </script>
    <style type="text/css">
        .login-div{
            -moz-box-shadow: 10px 10px 5px #444; /* 老的 Firefox */
            box-shadow: 10px 10px 5px #444;
            padding:30px;border-radius:15px;background:#ded6d6;
        }
        input{
            text-align:center;
            border:2px solid #a1a1a1;
            padding:10px 40px;
            background:#dddddd;
            border-radius:7px !important;
            -moz-border-radius:25px;
        }
        .login_wrapper{
            margin: 10% auto 0 !important;
        }
    </style>
</head>

<body class="login">
<div>
    <a class="hiddenanchor" id="signup"></a>
    <a class="hiddenanchor" id="signin"></a>

    <div class="login_wrapper">
        <div class="animate form login_form login-div">
            <section class="login_content">
                <form>
                    <h1>登录</h1>
                    <div>
                        <input type="text" name="account" class="form-control" placeholder="用户名" required="" />
                    </div>
                    <div>
                        <input type="password" name="password" class="form-control" placeholder="密码" required="" />
                    </div>
                    <div>
                        <a style="width:100%" class="btn btn-default submit" href="#">登录</a>
                    </div>

                    <div class="clearfix"></div>

                </form>
            </section>
        </div>       
    </div>
</div>
</body>
<script type="text/javascript">
    $(function () {
        $(".submit").click(function () {
            var account = $("input[name='account']").val();
            var password = $("input[name='password']").val();
            if(account.replace(/\s/g, '') == ''){
                alert("请输入登陆账号");
                return;
            }
            if(password.replace(/\s/g, '') == ''){
                alert("请输入密码");
                return;
            }
            var params = {};
            params['account'] = account;
            params['password'] = hex_md5(password);
            $.ajax({
                url:'/admin/loginOn.do',
                type:'post',
                data: params,
                success:function(data){
                    if(data.success){
                        window.location.href = "/html/admin/index.html";
                    }else{
                        alert(data.msg);
                    }
                },
                error:function () {
                    alert("系统错误！");
                }
            });
        });
        
    })
</script>
</html>
